<%@page import="java.sql.Timestamp"%>
<%@page import="com.toma.booking.dto.PictureDto"%>
<%@page import="java.util.List"%>
<%@page import="com.toma.booking.dto.BoardDto"%>
<%@page import="com.toma.booking.model.MemberService"%>
<%@page import="java.sql.Date"%>
<%@page import="com.toma.booking.dto.MemberDto"%>
<%@page import="org.apache.tiles.servlet.context.ServletUtil"%>
<%@page import="org.apache.tiles.TilesContainer"%>
<%@page contentType="text/html; charset=euc-kr" %>
<% request.setCharacterEncoding("euc-kr");%>
<% response.setContentType("text/html; charset=euc-kr");%>
<html>
<head>
<title>Insert title here</title>
</head>
<%
Object obj=session.getAttribute("loginDto");
MemberDto loginDto = (MemberDto)obj;
 
%>
<body>
<%!
private boolean isNull(String str){
	return str==null || str.trim().equals("");
}//
public void tilesGO(String tname,HttpServletRequest request,HttpServletResponse response){
	TilesContainer container = ServletUtil.getContainer(
	        request.getSession().getServletContext());
	container.render(tname, request, response);	
}
%>
<%
String command=request.getParameter("command");
MemberService service = MemberService.getInstance();
if(isNull(command)){
	%>
	<script type="text/javascript">
	history.go(-1);
	</script>
	<% 
}

%>
<%
if(command.equalsIgnoreCase("pic")){
	  String email = loginDto.getEmail();
	  //out.print("dddddd");
	  List<PictureDto> alllist=service.alllist(email);
	  request.setAttribute("alllist",alllist);
	  tilesGO("pboard",request,response);
  
}else if(command.equalsIgnoreCase("picup")){
	String email = loginDto.getEmail();
	List<PictureDto> alllist=service.alllist(email);
	request.setAttribute("plist",alllist);
	tilesGO("pic",request,response);

}else if(command.equalsIgnoreCase("pupload")){
	String email = loginDto.getEmail();
	List<PictureDto> alllist=service.alllist(email);
	if (obj!=null){
		String myemail=request.getParameter("myemail");
		String content=request.getParameter("content");
		String picture=request.getParameter("picture");
		request.setAttribute("plist",alllist);
		PictureDto dto=new PictureDto();
		 dto.setEmail(myemail);
		 dto.setName(content);
		 dto.setPicture(picture);
		 int pass=service.pic1(dto);
		 tilesGO("pupload",request,response);
		 
}else if(command.equalsIgnoreCase("pdetail")){
	System.out.println("===================");
	 String sseq=request.getParameter("seq");
	  int seq = Integer.parseInt(sseq);
	  out.println(seq);	
 	  PictureDto pdetail= service.list(seq);
	  request.setAttribute("list",pdetail);
// 	  out.print("1111111111111");
	
 	  tilesGO("detail", request, response);
}
  

}
%>

</body>
</html>
